var temp=sessionStorage.getItem('clbnb');
var url='https://www.cailianxinwen.com'
var userid=''
if(temp=='')
{
    window.location.href='index.html'
}
else{

    let obj = eval('(' + temp + ')');
    userid=obj.userid
    $('#tel').val(obj.tel)
    
}

$('#go').click(function(){

    if($('#name').val()=='')
    {
        alert('姓名不能为空')
        return;
    }
    if($('#card').val()=='')
    {
        alert('身份证号不能为空')
        return;
    }
    getCard($('#card').val())
})
function getCard(c){
    $.ajax({
        type: "post",
        url: url+'/app/blog/getCardT?card='+c,
         dataType: "text",
         //jsonp: "jsoncallback",
         success: function (json) {
            console.log(json)
            checksm($('#card').val(),$('#name').val(),json)
        },
         error: function (err) {
             console.log(err)
         }
     });
}
function checksm(c,n,token){
    alert(c)
    alert(n)
    alert(token)

    $.ajax({
        type: "post",
        url: url+'/app/blog/checkNameAndId?idCardNo='+c+'&name='+n+'&token='+token+'&userid='+userid,
         dataType: "json",
         //jsonp: "jsoncallback",
         success: function (json) {
            console.log(json)
            if(json.code==0)
            {
                window.location.href='message.html'
            }
            else{
                alert('认证失败')
            }
        },
         error: function (err) {
             console.log(err)
         }
     });
}